<?php
$root = Yii::app()->params['file'];
$model = new Folder("$root/$type/$path");
$total = count($model->imageFiles);
$pageSize = 12;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$start = $page * $pageSize - $pageSize;
$end = $page * $pageSize;
if ($end > $total) $end = $total;
?>

<div class="gallery">
	<?php
	$view = 'application.views.file';
	for ($i = $start; $i < $end; $i++) {
		$data = array(
			'type'=>$type,
			'path'=>$path,
			'data'=>$model->imageFiles[$i],
		);
		$this->renderPartial("$view._thumb", $data);
	}
	?>
</div>

<p />

<div class="pager">
	<?php
	$properties = array(
		'itemCount'=>$total,
		'currentPage'=>$page - 1,
		'pageSize'=>$pageSize,
		'maxButtonCount'=>5,
	);
	$this->widget('CLinkPager', $properties);
	?>
</div>

<?php
$options = array(
	'slideshow'=>5000,
	'autoplay_slideshow'=>false,
	'show_title'=>false
);
EPrettyPhoto::add('.gallery a', EPrettyPhoto::PRETTY_GALLERY,
	EPrettyPhoto::THEME_DARK_ROUNDED, $options);
?>